(function () {
	angular
	.module('ydApp.doc', [])
	.config(function ($stateProvider) {
		$stateProvider.state('doc-detail', {
			url: '/doc-detail/:docId',
			controller: "docDetailCtrl",
			templateUrl: 'views/docs/doc-detail.html'
		});
	})
	.controller("docDetailCtrl", docDetailCtrl);

	function docDetailCtrl ($scope, $stateParams, xhr, $state, popup) {
		var vm = $scope.vm = {};
		xhr.get("HealthInquiry/com/doctor/findById", {
			id: $stateParams.docId
		}).then(function (res) {
			vm.doc = res.data;
			console.log(res)
		});

		vm.toChat = function () {
			if (vm.doc.isOnline == 1) {
				$state.go('chat', {
					docId: $stateParams.docId,
					docHead: vm.doc.headImgUrl
				})
			}
		}
		vm.toGood = function (argument) {
			$state.go('doc-good', {
				docId: $stateParams.docId
			})
		}
	}
})();